package leetcode;

import java.util.HashSet;
import java.util.Set;

public class lengthOfLongestSubstring {

    public static void main(String[] args) {
        String s = "pwwkew";
        int ano = 0;
        for (int i = 0; i < s.length(); i++) {
            // 窗口移动法
            Set<Character> set = new HashSet<>();
            int end = i;
            while(end < s.length() && !set.contains(s.charAt(end))){
                set.add(s.charAt(end));
                ++ end;
            }
            ano = Math.max(ano, set.size());
        }
        System.out.println(ano);
    }
}
